﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;
using eschoolBO;

namespace ESCHOOL.students
{
    public partial class WebForm5 : System.Web.UI.Page
    {
        teacher teach=new teacher();
        student_feedback sf = new student_feedback();
        protected void Page_Load(object sender, EventArgs e)
        {
            if(!IsPostBack)
            {
                //Label1.Visible = false;
                DataTable dt=teach.GetRecords(-99,"","","","","","",-99,-99,-99,"","","","","",false," and ");
                DropDownList1.DataSource=dt;
                DropDownList1.DataTextField="teacher_name";
                DropDownList1.DataValueField="teacher_id";
                DropDownList1.DataBind();
                DataTable dt1 = sf.GetRecords(-99, Convert.ToInt64(Session["userid"]), -99, "", false, " and ");
                GridView1.DataSource = dt1;
                GridView1.DataBind();
                
            }
        }

        protected void btnsend_Click(object sender, EventArgs e)
        {
            sf.sfeedback_id = -99;
            sf.student_id = Convert.ToInt64(Session["userid"]);
            sf.teacher_id = Convert.ToInt64(DropDownList1.SelectedValue.ToString());
            sf.feedback = tbmsg.Text;
            sf.isdeleted = false;
            sf.SaveRecords();
            
            Response.Redirect("~/students/SFeedback.aspx");
        }

        protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            GridView1.PageIndex = e.NewPageIndex;
            DataTable dt1 = sf.GetRecords(-99, Convert.ToInt64(Session["userid"]), -99, "", false, " and ");
            GridView1.DataSource = dt1;
            GridView1.DataBind();
        }

        

        
    }
}
